package com.linws.service;

import com.linws.pojo.Dept;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.List;

public class DeptClientServiceFallbackFactory implements FallbackFactory {
    @Override
    public Object create(Throwable cause) {
        return new DeptClientService() {
            @Override
            public Dept queryById(Long id) {
                return new Dept().setDeptno(id)
                        .setDname("id"+id+"没有对应的信息，客户端提供了降级信息，这个服务现在已经关闭")
                        .setDb_source("没有数据");

            }

            @Override
            public List<Dept> queryAll() {
                return null;
            }

            @Override
            public boolean addDept(Dept dept) {
                return false;
            }
        };
    }
}
